package com.tsingteng.cosfun.widget.dialog.adapter;

import android.graphics.Bitmap;
import android.media.ThumbnailUtils;
import android.provider.MediaStore;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.tsingteng.cosfun.R;
import com.tsingteng.cosfun.bean.VideoSectionBean;
import com.tsingteng.cosfun.helper.VideoHelper;
import com.tsingteng.cosfun.utils.ImageUtils;


import static android.media.ThumbnailUtils.OPTIONS_RECYCLE_INPUT;

/**
 * 描述 :
 * 创建人: 肖利.
 * 时间:2018/9/18
 * qq(872179966)
 */

public class VideoSliceSelectAdapter extends BaseQuickAdapter<VideoSectionBean,BaseViewHolder>{
    public VideoSliceSelectAdapter() {
        super(R.layout.adapter);
    }

    @Override
    protected void convert(BaseViewHolder helper, VideoSectionBean item) {
        ImageView videoCover = helper.getView(R.id.iv_video_cover);
        TextView mTvNumber = helper.getView(R.id.tv_number);
        mTvNumber.setText(String.valueOf(helper.getAdapterPosition()+1));
        if (TextUtils.isEmpty(item.getLocalUrl())) {
            videoCover.setScaleType(ImageView.ScaleType.FIT_CENTER);
            ImageUtils.LoadImage(mContext,item,videoCover,R.drawable.add_fragment);
        }else {
            videoCover.setScaleType(ImageView.ScaleType.CENTER_CROP);
            ImageUtils.LoadImage(mContext,item.getUrlCover(),videoCover);
//            ImageUtils.LoadImage(mContext,item,videoCover,R.drawable.add_fragment);
//            videoCover.setImageBitmap(item.getBitmap());
        }
    }
}
